import React, { useState } from "react";
import { Menu } from "antd";
import { } from "@ant-design/icons";
import { Link } from "react-router-dom"


export default function ProjectMenu() {
    const [state, setState] = useState({
        current: 'apis',
    });

    const handleClick = (e: any) => {
        console.log('click ', e);
        setState({ current: e.key });
    };
    return (
        <div style={{ backgroundColor: "#fff" }}>
            <Menu
                onClick={handleClick}
                selectedKeys={[state.current]}
                mode="horizontal"
                style={{
                    width: "90%",
                    margin: "auto"
                }}
            >
                <Menu.Item key="apis">
                    <Link onClick={() => {sessionStorage.setItem("now", JSON.stringify({name: "全部接口", key: "allapi"}))}} to="/index/project/apis/allapi">接口</Link>
                </Menu.Item>
                <Menu.Item key="test">
                    <Link to="/index/project/test/servertest/testset">测试</Link>
                </Menu.Item>
                <Menu.Item key="sets">
                    <Link to="/index/project/settings">项目设置</Link>
                </Menu.Item>

            </Menu>
        </div>

    )
}